package lambda;

import java.util.HashMap;
import java.util.Map;

public class MxReduce {
    public static void main(String[] args) {
        Map<String, Bean> map = new HashMap<>();
        map.put("M1", new Bean("M1", 1d));
        map.put("M2", new Bean("M2", 2d));
        map.put("M3", new Bean("M3", -10d));
        double result = map.values().stream()
                .map(Bean::getAge)
                .reduce((sum, ele) -> sum + ele)
                .orElse(0d);
        System.out.println(result);
    }
}
